import { Form } from 'ant-design-vue'
import { ref } from 'vue'

const { useForm } = Form

export function usePostForm() {
  const show = ref(false)
  const loading = ref(false)
  const formModel = ref({
    postName: '',
    postCode: '',
    postSort: 0,
    status: '0',
    remark: ''
  } as ICreatePostDTO)
  const formRules = ref({
    postName: [{ required: true, message: '请输入' }],
    postCode: [{ required: true, message: '请输入' }],
    postSort: [{ required: true, message: '请输入' }]
  } as FormRules<ICreatePostDTO>)

  const formRef = useForm(formModel, formRules)

  return {
    show,
    loading,
    formRef,
    formModel
  }
}
